using Indiefreaks.Xna.Input;

namespace Indiefreaks.Xna.Sessions
{
    /// <summary>
    /// Represents a Local player that is identified in the game session
    /// </summary>
    public abstract class IdentifiedPlayer
    {
        /// <summary>
        /// Creates a new local player instance
        /// </summary>
        /// <param name="playerInput">The PlayerInput instance used by the Player</param>
        protected IdentifiedPlayer(PlayerInput playerInput)
        {
            Input = playerInput;
        }

        /// <summary>
        /// Creates a new remote player instance
        /// </summary>
        /// <param name="uniqueId">The id of the remote player</param>
        protected IdentifiedPlayer(string uniqueId)
        {
            UniqueId = uniqueId;
        }

        /// <summary>
        /// Returns the unique player id
        /// </summary>
        public string UniqueId { get; protected set; }

        /// <summary>
        /// Returns the current identified player input
        /// </summary>
        /// <remarks>Returns null if player is remote</remarks>
        public PlayerInput Input { get; private set; }

        /// <summary>
        /// Returns if the current player is local or remote
        /// </summary>
        public bool IsLocal
        {
            get { return Input != null; }
        }

        /// <summary>
        /// Returns if the current player is the Host of the session
        /// </summary>
        public bool IsHost { get; protected set; }
    }
}